const app = getApp();
import util from '../../utils/util'
import { SixList } from '../../config/api'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cat_id:'',
    page:1,
    limit:10,
    lists: [],//公告公开的数据
  },
  /**
   * 跳转到详情页面
   */
  ToMessageDetail: function (e) {
    let item = e.currentTarget.dataset['item'];
    console.log("点击事件传递的参数：", item);
    wx.navigateTo({
      // url:'/pages/newsDetail/newsDetail?item='+JSON.stringify(item)
      url: '/pages/newsDetail/newsDetail?id=' + item.id
    });
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    let id = options.id
    let that = this;
    let params = {
      page:that.data.page,
      limit:that.data.limit,
      cat_id: id,
      vollege_id: app.globalData.vollege_id
    }
    util.apiRequest(SixList, params, null).then(r => {
      console.log('刘健：', r);
      that.setData({
        lists: r.data.data.data
      });

      r.data.data.data.forEach(function(item,index){
        console.log('12111',item)
      })
    });
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})
